element

您所在的位置:网站首页 el-button loading element

element

2023-03-26 20:02| 来源: 网络整理| 查看: 265

demo: https://jsfiddle.net/nksc44b2/1/

问题是关于submitForm方法,我想实现以下几个效果,对submitForm方法进行重写:

1、点击提交按钮,loading的值改为true。2、当提交成功,跳转页面除了使用window.location.href,还有其他方法吗?另外,我要跳转到详情页,怎么传递参数?3、当提交失败,主要有两种情况。一是网络不通,二是登录session过期,两种情况的错误代码是什么?

//问题1 提交 submitForm(formName) { this.$refs[formName].validate((valid) => { if (valid) { //ajax提交到后台 axios.post('submit', formName) .then(response=>{ //问题2 window.location.href = "/profile/:id"; }) .catch(error=>{ //问题3 if(){ //如果session过期,应该怎么写这个if条件? window.location.href = "/login";//跳转到登录页 }elseif(){ //网络不通,应该怎么写这个if条件? this.$message({ type: 'info', message: '网络不通,提交失败!' }); } }); } else { console.log('error submit!!'); return false; } });

请大神帮看看,谢谢



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3